package com.itheima.advantagesup.dto;

import com.itheima.advantagesup.entity.SysMenu;
import com.itheima.advantagesup.vo.MenuVO;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

import lombok.Data;


@Data
public class MenuDTO {
    private Integer id;
    private Integer pid;
    private String path;
    private String component;
    private String title;
    private String icon;
    private Integer is_show;
    private Integer is_cache;
    private Integer is_link;
    private String redirect;
    private LocalDateTime createDate;
    private LocalDateTime updateDate;
    private Integer del_flag;
    private Integer type;
    private BigDecimal sort;
    private String mark;
    private String default_data;
    private List<MenuVO> children;

    public SysMenu convertToEntity() {
        SysMenu sysMenu = new SysMenu();
        sysMenu.setId(this.id);
        sysMenu.setPid(this.pid);
        sysMenu.setPath(this.path);
        sysMenu.setComponent(this.component);
        sysMenu.setTitle(this.title);
        sysMenu.setIcon(this.icon);
        sysMenu.setIsShow(this.is_show);
        sysMenu.setIsCache(this.is_cache);
        sysMenu.setIsLink(this.is_link);
        sysMenu.setRedirect(this.redirect);
        sysMenu.setCreateDate(this.createDate);
        sysMenu.setUpdateDate(this.updateDate);
        sysMenu.setDelFlag(this.del_flag);
        sysMenu.setType(this.type);
        sysMenu.setSort(this.sort);
        sysMenu.setMark(this.mark);
        sysMenu.setDefaultData(this.default_data);
        return sysMenu;
    }
}
